package com.zsw.config;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.DirectExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


@Configuration
public class DirectRabbitConfig {
    @Bean
    public Queue ticketQueue(){
        return new Queue("ticketProvider",true);
    }
    @Bean
    DirectExchange ticketDirectExchange(){
        return new DirectExchange("ticketExchange",true,false);
    }
    @Bean
    Binding bindingDirect(){
        return BindingBuilder.bind(ticketQueue()).to(ticketDirectExchange()).with("ticket");
    }

    @Bean
    DirectExchange bindDirectExchange(){
        return new DirectExchange("ticketExchange");
    }
}
